<!DOCTYPE html>
<#assign ctx=Session.basePath>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>服务信息</title>
    <script>
        var shipid = '<#if shipid??>${shipid}<#else></#if>';
        var company =  '<#if company??>${company}<#else></#if>';
    </script>
    <link href="${ctx}/easyui/themes/bootstrap/easyui.css" rel="stylesheet" />
    <link href="${ctx}/easyui/themes/icon.css" rel="stylesheet" />
    <link href="${ctx}/inspiniain/font-awesome/css/font-awesome.css" rel="stylesheet">
    <script src="${ctx}/js/jquery-1.12.2.min.js"></script>
    <script src="${ctx}/lib/jquery.form.js"></script>
    <script src="${ctx}/easyui/jquery.easyui.min.js"></script>
    <script src="${ctx}/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="${ctx}/pagination/js/layer/layer.js"></script>
    <#--<script src="${ctx}/map/js/ol2/Olinit.js"></script>-->

</head>
<body>

<div id="tb" style="padding:5px;height:auto">
    <div>
        关键字:<input id="title" class="easyui-text" style="width:100px">
        <a href="#" class="easyui-linkbutton btn-search" iconCls="icon-search" style="width: 70px;">查找</a>
    </div>
 </div>

<table id="dg"
       data-options="rownumbers:true,singleSelect:true,pagination:true,url:'${ctx}/manage/map/server/ajax/data/page/list',method:'post',toolbar:'#tb',nowrap:false">
    <thead>
    <tr>
        <th data-options="field:'navigate',width:70">地理名称</th>
        <th data-options="field:'serverType',width:60">服务类型</th>
        <th data-options="field:'message',width:120" >内容</th>
        <#--<th data-options="field:'keyword',width:60">关键字</th>-->
        <#--<th data-options="field:'state',width:30">状态</th>-->
        <#--<th data-options="field:'drop',width:50,align:'center'">操作</th>-->
        <#--<th data-options="field:'navigate',width:50,align:'center'">定位</th>-->
    </tr>
    </thead>
</table>
<script type="text/javascript">
    function loadAll() {
        var pager = $('#dg').datagrid({
            fitColumns: true,
            fit: true,
            loadFilter: function (data) {
                // alert(data);
                if (data != null && data.rows != null) {
                    for (var i = 0; i < data.rows.length; i++) {
                        var record = data.rows[i];
//                    console.log(record)
//                        var state = "";
//                        if(record.state == "0"){
//                           state = "未审核";
//                        }else if(record.state == "1"){
//                           state = "待审核";
//                        }else{
//                           state = "已审核";
//                        }
//                        record.state = state;
//                        var drop = "<a href='#' onclick='dropServer(\"" + record.ssid + "\")'>删除</a>";
//                        record.drop = drop;
                        //var servertype = record.serverType;
                        //record.state="<a href='#' onclick='setVtsState(\""+midLon+"\",\""+midLat+"\",\""+record.title+"\",\""+record.guid+"\",\""+record.isValid+"\")'>"+isValid+"</a>";
                        record.navigate = "<a href='#' onclick='locationMap(\"" + record.drawGeomInfo.id + "\",\"" + record.message + "\")'>" +
                                record.drawGeomInfo.name +
                                "</a>";
                    }
                }
                return data;
            }
        })

        var page=$('#dg').datagrid('getPager');
        page.pagination({
            layout:['first','prev','next','last','refresh'],
            showRefresh:true
        });
    };	// get the pager of datagrid
$(function () {
    loadAll();
    $(".btn-search").click(function () {
        $('#dg').datagrid("load",{
            keyword : $("#title").val()
        })
    })
})
    <#--function dropServer(id){-->
        <#--$.ajax({-->
            <#--url:'${ctx}/manage/map/server/dropServer',-->
            <#--data:{ssid:id},-->
            <#--success: function (data) {-->
                <#--if(data){-->
                    <#--loadAll();-->
                    <#--window.parent.source.removeFeature(feature);-->
                <#--}-->

            <#--}-->
        <#--});-->
    <#--}-->

    function locationMap(geoid,message) {
//        console.log(message);
        window.parent.locServer(geoid,'server',message);
//        window.parent.layer.closeAll();
    }
</script>


</body>
</html>